Firebase Cloud Messagingを使ってiOSアプリにPush通知を送る - Kumanote corporate website
Firebase Cloud Messagingを使ってiOSアプリにPush通知を送る - Kumanote corporate website
code:bash
openssl pkcs12 -in aps_development.p12 -out aps_development.pem -nodes -clcerts
curl --http2 --cert ./aps_development.pem \
-H "apns-topic: com.kumano-te.portfolio-ios" \
-d '{"aps":{"alert":"Hello from APNs!","sound":"default"}}' \
https://api.development.push.apple.com/3/device/your-APNs-device-token-here
Apnsが動いてるかの確認は証明書でcurl叩けばレスポンスが返ってくる
.p12で証明書を作成してなくて.p8のキーで作成してたため試してない。
多分pkcs8みたいなのも使えるみたいなのでp8をpemに変えればリクエストできるかなとは思う
deviceTokenの取得はメソッドのスウィズリングを無効を参考に